class PasswordController < ApplicationController

	def edit
		@user = current_user
	end

	def update
		@user = current_user
		if @user.update_with_password(user_params)
	      redirect_to new_user_session_path, notice: '修过密码成功，请重新登录'
	    else
	      #send_form_error(@user.errors)
	      render :edit
	    end

	end


	private
	def user_params
      params.require(:user).permit(:current_password,:password,:password_confirmation)
    end

end